package com.filipinas.calculadora;

import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MyListener implements OnClickListener{
	private Activity act;
	
	//private double _operando1 = (R.id.pantalla);

	
	public MyListener(Activity act){
		this.act = act;
	}
	
	public void onClick(View v){
		Button bNumeros = (Button)v;
		switch(bNumeros.getId()){
		case R.id.uno:
            ((CalcActivity)act).addText("1");
            break;
		case R.id.dos:
			((CalcActivity)act).addText("2");
			break;
		case R.id.tres:
			((CalcActivity)act).addText("3");
			break;
		case R.id.cuatro:
			((CalcActivity)act).addText("4");
			break;
		case R.id.cinco:
			((CalcActivity)act).addText("5");
			break;
		case R.id.seis:
			((CalcActivity)act).addText("6");
			break;
		case R.id.siete:
			((CalcActivity)act).addText("7");
			break;
		case R.id.ocho:
			((CalcActivity)act).addText("8");
			break;
		case R.id.nueve:
			((CalcActivity)act).addText("9");
			break;
		case R.id.cero:
			((CalcActivity)act).addText("0");
			break;
		case R.id.punto:
			((CalcActivity)act).pintaPunto(".");
			break;
		case R.id.suma:
			((CalcActivity)act).operacion("+");
			break;
		case R.id.resta:
			((CalcActivity)act).operacion("-");
			break;
		case R.id.multiplica:
			((CalcActivity)act).operacion("*");
			break;
		case R.id.divide:
			((CalcActivity)act).operacion("/");
			break;
		case R.id.masMenos:
			((CalcActivity)act).cambioSigno("masMenos");
			break;
		case R.id.cancel:
			((CalcActivity)act).limpiar("cancel");
		case R.id.igual:
			((CalcActivity)act).resultado();
		
//		default:
//			String num = bCalculos.getText().toString();
//			((CalcActivity)act).addText(num);
//			break;
		}
	}
}

